from selenium import webdriver
import time
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

dr = webdriver.Chrome()
dr.get("file:///C:/Users/Administrator/Desktop/自动化测试网页/自动化测试网页/注册A.html")
dr.maximize_window()
time.sleep(2)
# 找到元素
e = dr.find_element(By.ID,"userA")
# 鼠标对象实例化
action = ActionChains(dr)
# 右键元素
action.context_click(e)
# 执行操作
action.perform()
time.sleep(2)
dr.quit()